﻿using EmbeddedSharp.Core;
using Zove.Runtime.Core;

namespace Ascend.Runtime.Core
{
    public class AscendExpressionParserFactory : IExpressionParserFactory
    {
        protected ILanguageNature LanguageNature;

        public AscendExpressionParserFactory(ILanguageNature languageNature)
        {
            LanguageNature = languageNature;
        }
        #region IExpressionParserFactory Members

        public ExpressionParser CreateParser(string expr, object context)
        {
            var parser = new AscendExpressionParser(expr);
            parser.FunctionManager = LanguageNature.FunctionManager;

            return parser;
        }

        public ExpressionParser CreateParser(string expr)
        {
            var parser = new AscendExpressionParser(expr);
            parser.FunctionManager = LanguageNature.FunctionManager;

            return parser;
        }

        #endregion
    }
}